package com.Test;

import com.DAO.DatabaseConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class Test_DAO {
    public static void main(String[] args) {
        DatabaseConnection databaseConnection=new DatabaseConnection();
        try {
            Connection connection=databaseConnection.getconn("hotel","root","");
            Statement statement=connection.createStatement();
            String sql="select * from house";
            ResultSet resultSet=statement.executeQuery(sql);
            System.out.println("房间编号\t房间类型\t可住人数\t状态");
            while (resultSet.next()){
                System.out.print(resultSet.getInt("房间编号")+"\t");
                System.out.print(resultSet.getString("房间类型")+"\t");
                System.out.print(resultSet.getInt("可住人数")+"\t");
                System.out.print(resultSet.getInt("状态")==1?"不可住":"可住"+"\t");
                System.out.println();
            }
        }catch (Exception e){
             e.printStackTrace();
        }
    }
}
